/*
 * Copyright 2024 Redpanda Data, Inc.
 *
 * Licensed as a Redpanda Enterprise file under the Redpanda Community
 * License (the "License"); you may not use this file except in compliance with
 * the License. You may obtain a copy of the License at
 *
 * https://github.com/redpanda-data/redpanda/blob/master/licenses/rcl.md
 */
#include "cloud_topics/types.h"

#include <fmt/core.h>

auto fmt::formatter<cloud_topics::object_id>::format(
  const cloud_topics::object_id& id, fmt::format_context& ctx) const
  -> decltype(ctx.out()) {
    return fmt::format_to(ctx.out(), "{}/{}", id.epoch(), id.name);
}

auto fmt::formatter<cloud_topics::ctp_stm_object_ownership>::format(
  cloud_topics::ctp_stm_object_ownership ownership,
  fmt::format_context& ctx) const -> decltype(ctx.out()) {
    switch (ownership) {
    case cloud_topics::ctp_stm_object_ownership::exclusive:
        return fmt::format_to(ctx.out(), "exclusive");
    case cloud_topics::ctp_stm_object_ownership::shared:
        return fmt::format_to(ctx.out(), "shared");
    }
}
